<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title><?php echo C('SERVER_NAME');?></title>
	<link rel="stylesheet" type="text/css" href="/Public/admin/css/style.css">
</head>
<body>
	<div class="content p50">
		<div class="content-title"><h2>云推送列表</h2></div>
		<div class="p20">
		<form action="/Admin/Push/pushList.html">
			<div class="search-box">				
				<span class="search-title">用户名：</span><span class="search fl"><input type="text" name="secuname" value="<?php echo ($_GET['secuname']); ?>" placeholder="请输入"></span>
				<span class="search-title">状态：</span><span class="search-select">
				<select name="secstatus">
					<option value="">请选择</option>
					<option value="0">未审核</option>
					<option value="1">已通过</option>
					<option value="2">未通过</option>
				</select>
				</span>
				<input type="submit" class="search-btn fl" value="">
			</div>
		</form>	
			<table class="table">
				<thead>
					<tr>
						<th>序号</th>
						<th>用户名</th>
						<th>套餐</th>
						<th>提交时间</th>
						<th>状态</th>
						<th>完成情况</th>		
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<?php if(is_array($pushList)): $i = 0; $__LIST__ = $pushList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
						<td><?php echo ($key+1); ?></td>
						<td><?php echo ($vo["userName"]); ?></td>
						<td><?php echo ($vo["packageName"]); ?></td>
						<td><?php echo ($vo["add_time"]); ?></td>
						<td><?php echo $apply_status[$vo["is_apply"]]; ?></td>
						<td><?php echo $ok_status[$vo["is_ok"]]; ?></td>
						<td>
						<?php if($vo['is_apply'] == 1 and $vo['is_ok'] == 0): ?><a href="javascript:;" class="change_push" data-type="ok" data-status="1" data-id="<?php echo ($vo["id"]); ?>">确定完成</a>|<?php endif; ?>
						<?php if($vo['is_apply'] == 0): ?><a href="javascript:;" class="change_push" data-type="apply" data-status="1" data-id="<?php echo ($vo["id"]); ?>">通过</a>
							<a href="javascript:;" class="change_push" data-type="apply" data-status="2" data-id="<?php echo ($vo["id"]); ?>">不通过</a>|<?php endif; ?>
						<a href="<?php echo U('Push/pushDetails',array('id'=>$vo['id']));?>">详情</a>
						</td>
					</tr><?php endforeach; endif; else: echo "" ;endif; ?>	
				</tbody>
			</table>
			<div class="page">
			<?php echo ($page); ?>
			</div>
		</div>
	</div>
	<div class="layer-box">
		<div class="layer-gray">
			<div class="text"></div>
		</div>
	</div>
	<div class="layer-box">
	<div class="layer">
		<div class="shut fr"><img src="/Public/images/close.png"></div>
		<div class="text">alert</div>
		<div class="btn"><a href="#" class="confirm">确定</a><a href="#" class="close">取消</a></div>
	</div>
</div>
	<script type="text/javascript" src="/Public/js/jquery-1.7.min.js"></script>
	<script type="text/javascript" src="/Public/admin/js/page.js"></script>
	<script type="text/javascript">
		
		$(function(){
			$("select[name=secstatus]").val("<?php echo ($_GET['secstatus']); ?>");
		});

		//审核代写
		$(".change_push").click(function(){

			var _this=$(this);
			modelConfirm("确定后无法更改，是否确定",function(){

				var type=_this.attr("data-type");
				var status=_this.attr("data-status");
				var id=_this.attr("data-id");

				if(!type || !status || !id){
					prompting("参数出错，请刷新后重试！");
					return false;
				}

				$.post("/Admin/Push/ajaxChangePush",{"type":type,"ids":id,"status":status},function(data){

					modelConfirm(data.info,function(){
						window.location.reload();
					},function(){
						window.location.reload();
					});
				});
			});
		});
	</script>
</body>
</html>